package scenetracer.core.primitive;

import scenetracer.core.Primitive;
import scenetracer.math.Point3;
import scenetracer.math.Vector3;

public class IntersectionState {
	
	private Primitive primitive;
	private Point3 intersectionPoint = new Point3();
	private IntersectionKind kind = IntersectionKind.MISSED;
	private Vector3 normal= new Vector3();

	public enum IntersectionKind {
	    IN (-1),
	    OUT (1),
	    MISSED (0);
	    
	    public int coeficient;
	    
	    IntersectionKind(int coeficient) {
	    	this.coeficient = coeficient;
	    }
	}

	
	public IntersectionState(){

	}
	

	public IntersectionState(Point3 intersection){
		setIntersectionPoint(intersection);
		
	}
	public IntersectionState(IntersectionState intersection){
		this.copyFromAnother(intersection);		
	}

	public void copyFromAnother(IntersectionState intersection) {
		this.kind = intersection.kind;
		this.primitive= intersection.primitive;
	
		setIntersectionPoint(intersection.getIntersectionPoint());
		setNormal(intersection.getNormal());
	}
	

	public void setIntersectionKind(IntersectionKind kind) {
		this.kind = kind;
	}

	public IntersectionKind getIntersectionKind() {
		return kind;
	}

	public Vector3 getNormal() {
		return normal;
	}

	public void setNormal(Vector3 normal) {
		this.normal.x = normal.x;
		this.normal.y = normal.y;
		this.normal.z = normal.z;
	}

	public Primitive getPrimitive() {
		return primitive;
	}

	public void setPrimitive(Primitive primitive) {
		this.primitive = primitive;
	}

	public Point3 getIntersectionPoint() {
		return intersectionPoint;
	}

	public void setIntersectionPoint(Point3 intersectionPoint) {
		this.intersectionPoint.x = intersectionPoint.x;
		this.intersectionPoint.y = intersectionPoint.y;
		this.intersectionPoint.z = intersectionPoint.z;
	}
	
}
